import request from '@/utils/request';

export async function getInspectionTaskByPage(params: any) {
  return request('/api/quality/getInspectionTaskByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addInspectionTask(params: any) {
  return request('/api/quality/addInspectionTask', {
    method: 'POST',
    data: params,
  });
}

export async function updateInspectionTask(params: any) {
  return request('/api/quality/updateInspectionTask', {
    method: 'POST',
    data: params,
  });
}

export async function delInspectionTask(params: any) {
  return request('/api/quality/delInspectionTask', {
    method: 'POST',
    data: params,
  });
}

export async function exportInspectionTask(params: any) {
  return request('/api/quality/exportInspectionTask', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

//查看/api/quality/getInspectionTaskById
export async function getInspectionTaskById(params: any) {
  return request('/api/quality/getInspectionTaskById', {
    method: 'POST',
    params: {
      inspectionTaskId: params,
    },
  });
}

//完成/api/quality/finishInspectionTask
export async function finishInspectionTask(params: any) {
  return request('/api/quality/finishInspectionTask', {
    method: 'POST',
    params: {
      id: params,
    },
  });
}

//提交检验单/api/quality/submitInspectionTask
export async function submitInspectionTask(params: any) {
  return request('/api/quality/submitInspectionTask', {
    method: 'POST',
    data: params,
  });
}

// ///api/quality/getInspectionTaskById
// export async function getInspectionTaskById(params: any) {
//   return request('/api/quality/getInspectionTaskById', {
//     method: 'POST',
//     inspectionTaskId: params,
//   });
// }

export default {
  getInspectionTaskByPage,
  addInspectionTask,
  updateInspectionTask,
  delInspectionTask,
  exportInspectionTask,
  getInspectionTaskById,
};
